/* @(#)GSOrderStockStatReportQueryAction.java
 *
 * Project: BUS
 *
 * Modify Information:
 * =============================================================================
 *   Author       Date       Description
 *   ------------ ---------- ---------------------------------------------------
 *   RoadZheng 2006-3-13    建立
 *
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room,
 *        Science & Technology Building, No. 9 South Street, Zhong Guan Cun,
 *        Haidian District, Beijing ,100081, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with HiTRUST.
 *
 * Warning:
 * =============================================================================
 *
 */

package com.hitrust.gs.action.report;

import com.hitrust.gs.service.*;
import com.hitrust.gs.lib.GSLogWriter;
import com.hitrust.gs.business.GSOrgProcessor;
import com.hitrust.gs.util.page.ResultProcess;
import com.hitrust.gs.bean.GSOperatorBean;
import java.util.ArrayList;
import com.hitrust.gs.form.report.GSOrderStockStatReportQueryForm;
import com.hitrust.gs.business.report.GSOrderQuery;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.util.exception.GSException;

public class GSOrderStockStatReportQueryAction extends GSBaseAction {
    public String execute(GSBaseForm aForm) throws Exception {
    	GSOrderStockStatReportQueryForm tForm = (
                GSOrderStockStatReportQueryForm) aForm;
    	aForm.getRequest().setAttribute("orderid",tForm.getOrderid());
    	aForm.getRequest().setAttribute("manufacturename",tForm.getManufacturename());
    	aForm.getRequest().setAttribute("createdatemin",tForm.getCreatedatemin());
    	aForm.getRequest().setAttribute("createdatemax",tForm.getCreatedatemax());
    	aForm.getRequest().setAttribute("ordercategory",tForm.getOrdercategory());
    	aForm.getRequest().setAttribute("workcorpid",tForm.getWorkcorpid());
    	
        GSOperatorBean operatorBean = (GSOperatorBean) aForm.getSession().
                                      getAttribute(GSBaseConstants.LOGIN);

        GSOrgProcessor processer = new GSOrgProcessor();
        GSOrderQuery query = new GSOrderQuery();

        try {
            ArrayList ary = processer.getOperOrgAndSubOrg(operatorBean.
                    getGs_oper_org_id());
            aForm.getRequest().setAttribute("orglist", ary);

            
            ArrayList tList = query.selectStockStatOrder(tForm);
            ResultProcess tRsProc = new ResultProcess();
            tRsProc.setResult(tList);
            aForm.getRequest().setAttribute("orderlist", tRsProc);

            //暂时用此方法传递分页参数
            aForm.getRequest().setAttribute("choice",
                                            aForm.getRequest().
                                            getParameter("choice"));

        } catch (GSException e) {
            GSLogWriter.error(this, e.toString());
            aForm.getRequest().setAttribute("action", "A301201.do");
            throw e;
        }

        return GSBaseConstants.FORWARD_SUCCESS;

    }

}
